<extend name="Base/base" />
<block name="button">
	
	<button class="btn btn-primary" type="submit" form="form"><i class="fa fa-save"></i> {:L('text_save')}</button>
</block>
<block name="body">
	<if condition="$msg">
		<div class="alert alert-danger alert-dismissible fade in" role="alert">
		      <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
		      {$msg.warning}

		    </div>
	</if>
	<div class="panel panel-default">
		<div class="panel-heading">
			<h4><i class="fa fa-pencil fa-fw"></i>  {$heading_title|default=L('heading_title')}</h4>
		</div>
		<div class="panel-body">
			<form action="" method="post" id="form" class="form-horizontal">
				<div class="form-group required">
					<label for="input-name" class="col-sm-2 control-label">{:L('entry_name')}</label>
					<div class="col-sm-10">
						<input type="text" value="{$permission.name|default=''}" placeholder="{:L('entry_name')}" name="name" class="form-control" id="input-name">
						<if condition="isset($msg['name'])">
						{:danger_msg($msg['name'])}
						</if>
					</div>
						
				</div>
				<div class="form-group">
					<label for="input-parent" class="control-label col-sm-2">{:L('entry_parent')}</label>
					<div class="col-sm-10">
						<select name="parent_id" id="input-parent" class="form-control">
							<option value="0">{:L('text_root')}</option>
							<foreach name="parents" item="parent">
								<option {:(isset($permission['parent_id']) && $parent['permission_id']==$permission['parent_id'])?'selected':''} value="{$parent.permission_id}">{$parent.title}</option>
							</foreach>
						</select>
					</div>
				</div>
				<div class="tab-pane">
					<ul class="nav nav-tabs">
						<foreach name="languages" key="key" item="language">
							<li class="{$key?'':'active'}">
								<a href="#language{$language.language_id}" data-toggle="tab"><img src="__PUBLIC__/Images/flags/{$language.image}">  {$language.name}</a>
							</li>
						</foreach>
					</ul>
					<div class="tab-content">
							<foreach name="languages" key="key" item="language">
								<div class="tab-pane <?php if(!$key) echo 'active'; ?>" id="language{$language.language_id}">
									<div class="form-group required">
										<label for="input-title{$language.language_id}" class="col-sm-2 control-label">{:L('entry_title')}</label>
										<div class="col-sm-10">
											<input type="text" name="description[{$language.language_id}][title]" value="{$permission['description'][$language['language_id']]['title']|default=''}" placeholder="{:L('entry_title')}" id="iput-title{$language.language_id}" class="form-control">
											<if condition="isset($msg['title'][$language['language_id']])">
											{:danger_msg($msg['title'][$language['language_id']])}
											</if>
										</div>
									</div>
									<div class="form-group">
										<label for="input-description{$language.language_id}" class="col-sm-2 control-label">{:L('entry_description')}</label>
										<div class="col-sm-10">
											<textarea rows="5" name="description[{$language.language_id}][description]" id="input-description{$language.language_id}" class="form-control">{$permission['description'][$language['language_id']]['description']|default=''}</textarea>
										</div>
									</div>						
								</div>
							</foreach>
						</div>
				</div>
			</form>
		</div>
	</div>
</block>
